package branch;

import java.util.Scanner;

public class calc
{
    public static void main(String args[])
    {
        System.out.println("请输入两个整数：");
        Scanner sc =  new Scanner(System.in);
        double num1 = sc.nextDouble();
        double num2 = sc.nextDouble();
        System.out.println("请输入运算符：");
        String operator = sc.next();
        double result = test1(num1,num2,operator);
        System.out.println(result);
    }
    public static double test1(double num1,double num2,String operator)
    {
        switch(operator)
        {
            case "+":
                return num1+num2;
            case "-":
                return num1 - num2;
            case "*":
                return num1*num2;
            case "/" :
                return num1/num2;
            default:
                System.out.println("输入运算符有误,请重试");
                return 0;
        }
    }

}
